<template>
    <div>
        <ul>
            <li v-for="msg in messageList" :key="msg.id">
                <!--跳转路由并携带 param 参数；to的字符串写法-->
                <!--<router-link :to="`/home/message/detail/${msg.id}/${msg.title}`">{{ msg.title }}</router-link>-->
                <!--跳转路由并携带 query 参数；to的对象写法-->
                <router-link :to="{
                                    name: 'xiangqing',
                                    params: {
                                        id: msg.id,
                                        title: msg.title
                                    }
                                }">
                {{ msg.title }}
                </router-link>
            </li>
        </ul>
        <hr>
        <router-view></router-view>
    </div>
</template>

<script>
    export default {
        name: 'Message',
        data() {
            return {
                messageList: [
                    {id: '001', title: 'message001'},
                    {id: '002', title: 'message002'},
                    {id: '003', title: 'message003'},
                    {id: '004', title: 'message004'},
                    {id: '005', title: 'message005'},
                ]

            }
        }
    }
</script>